package org.example.controller;

import lombok.extern.slf4j.Slf4j;
import org.example.JavaBean.User;
import org.example.util.JsonResult;
import org.example.util.ResultTool;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther:Liu
 * @Testname:fifthcontroller
 * @Date:2025/7/30 16:58
 */
@CrossOrigin(maxAge = 3600)
@Slf4j
@RestController
@RequestMapping("/fifth")
public class fifthcontroller {

    @GetMapping("/a")
    public JsonResult a(){
        log.info("用户访问了fifthcontroller的a方法");
        return ResultTool.success("用户访问了fifthcontroller的a方法");
    }

    @PostMapping("/b")
    public JsonResult b(String name,int age){
        log.info("用户访问了fifthcontroller的b方法");
        log.info("name:{},age:{}",name,age);
        return ResultTool.success("用户访问了fifthcontroller的b方法");
    }

    @PostMapping("/c")
    public JsonResult c(User user){
        log.info("用户访问了fifthcontroller的c方法");
        log.info("user:{}",user);
        return ResultTool.success("用户访问了fifthcontroller的c方法");
    }

    @PostMapping("/d")
    public JsonResult d(@RequestBody User user){
        log.info("用户访问了fifthcontroller的d方法");
        log.info("user:{}",user);
        return ResultTool.success("用户访问了fifthcontroller的d方法");
    }

    @PutMapping("/e")
    public JsonResult e(User user){
        log.info("用户访问了fifthcontroller的e方法");
        log.info("user:{}",user);
        return ResultTool.success("用户访问了fifthcontroller的e方法");
    }

    @DeleteMapping("/f")
    public JsonResult f(User user){
        log.info("用户访问了fifthcontroller的f方法");
        log.info("user:{}",user);
        return ResultTool.success("用户访问了fifthcontroller的f方法");
    }


}
